home *** CD-ROM | disk | FTP | other *** search
- print "
- Welcome to the installer program for webdata, the easiest database program
- for the world wide web. The installer will ask you a few questions about
- your server. You should complete the worksheet included in the readme.html
- document before continuing. By pressing \'y\' you are agreeing to absolve the
- authors of all liability related to use of this program.
-
- Would you like to continue? [y,n]
- ";
- $_ = <STDIN>;
- if (/^n/i) {exit;};
-
- print "
- Choose a short name for this database:
- ";
- $dbname=<STDIN>;
- chop($dbname);
-
- $webdata = "webdata_$dbname".".pl";
- $userform = $dbname."_form.html";
- $admin = $dbname."_admin.html";
- $memberentry = $dbname."_members.html";
- $webdatafields = $dbname."_fields.log";
- $datalog = $dbname."_data.log";
- $memberfile = $dbname."_members.log";
- $reportpref= $dbname."_report.log";
-
- $dirname="/cgi-bin/$webdata";
- print "\nPlease enter the path to the /cgi-bin/ directory:\n";
- $pathToCgiBin = <STDIN> ;
- chop($pathToCgiBin);
-
- print "\n";
- print "\nWhat is the URL of your homepage?
- (start with http://)\n";
- $homepage = <STDIN>;
-
- $password=" ";
- until ($password eq $second) {
- if ($password ne " ") {print "Not a match, try again.\n\n"};
- print "\nWhat would you like you password to be?\n";
- $password = <STDIN>;
- print "\nPlease enter your password again.\n";
- $second = <STDIN>;
- };
-
- print "\n";
- print "Would you like visitors to be able to ADD entries to the database? (y/n)\n";
- $useradd = <STDIN>;
- chop ($useradd);
- $_=$useradd;
- if (/^y/i) {$useradd = "true"} else {$useradd = "false"};
-
- print "\n";
- print "Would you like visitors to be able to SEARCH the database? (y/n)\n";
- $usersearch = <STDIN>;
- chop ($usersearch);
- $_=$usersearch;
- if (/^y/i) {$usersearch = "true"} else {$usersearch = "false"};
-
-
- open(CGIREAD,"<webdata.cgi");
- @lines = <CGIREAD>;
- close CGIREAD;
- $now=time();
- $path = `chdir`;
- chop($path);
- $idcode=substr($now,-4);
-
- chop($homepage);
- chop($password);
-
- $lines[0]="\#\n";
- $lines[7]="\$homepage=\"$homepage\"\;\n";
- $lines[8]="\$password=\"$password\"\;\n";
- $lines[9]="\$cgilocation=\"$webdata\"\;\n";
- $lines[10]="\$logfile=\'$path\\$datalog\'\;\n";
- $lines[11]="\$fieldnames=\'$path\\$webdatafields\'\;\n";
- $lines[12]="\$members=\'$path\\$memberfile\'\;\n";
- $lines[13]="\$reportdata=\'$path/$reportpref\'\;\n";
- $lines[14]="\$code=\'$idcode\'\;\n";
-
- foreach (@lines) {
- if ((/<!--FLAG1-->/)&&($useradd eq "false")) {$_="<!--FLAG1-->\n"};
- if ((/<!--FLAG2-->/)&&($useradd eq "true")) {$_="#<!--FLAG2-->\n"};
- if ((/<!--FLAG3-->/)&&($usersearch eq "false")) {$_="<!--FLAG3-->\n"};
- if ((/<!--FLAG4-->/)&&($usersearch eq "true")) {$_="#<!--FLAG4-->\n"};
- if (/<!--FLAG5-->/) {$_="\$key=$now\; #<!--FLAG5-->\n"};
- };
- open(DATA,">$logfile");
- print DATA ("111::Delete Me\n");
- close DATA;
-
- open(CGIWRITE,">$webdata");
- print CGIWRITE (@lines);
- close CGIWRITE;
-
- print "\n
- The Installer will help you define your list of fields.
- Fields are the attributes you wish to record about each entry,
- for example, FirstName, LastName, Color, Make, Model, EntryDate,
- PartNumber, etc.
-
- Press [ENTER] when you are finished entering fields. If you make a mistake,
- press [ENTER] and choose No when asked if you are satisfied with the list.
-
- ";
-
- $tryagain="true";
- while ($tryagain eq "true") {
- $time = time();
- @fields = ("webdata$time\n");
- print "Enter a field name: ";
- $field = <STDIN>;
- push(@fields,$field);
- $morefields="true";
- while ($morefields eq "true") {
- print "Enter another field name: ";
- $field = <STDIN> ;
- push(@fields,$field);
- $_=$field;
- if (/./) {$morefields = "true"} else {$morefields = "false"};
- };
- print "\n";
- pop(@fields);
- foreach $field (@fields) {
- if (substr($field,0,7) ne 'webdata') {print "$field";};
- };
-
- print "\nAre you satisfied with the field list? (y/n)
- [Type \'y\' to keep the list, \'n\' to enter the fields again]";
- $tryagain = <STDIN>;
- $_=$tryagain;
- if (/^y/i) {$tryagain = "false"} else {$tryagain = "true"};
- };
-
- foreach (@fields) {
- chop($_);
- $_=$_."::text:20\n";
- };
- open(FIELDLIST,">$webdatafields");
- print FIELDLIST (@fields);
- close FIELDLIST;
-
- $rc=@fields;
- for($i=0;$i<$rc-1;$i++) {
- $row.="$i:";
- };
- chop($row);
- open(REPORT,">$reportpref");
- print REPORT ("BEIGE\n\n$row\n0\n0\n15\n0\n\n1\n");
- close REPORT;
-
- open(FIELDS,"<$webdatafields");
- @fields = <FIELDS>;
- close FIELDS;
-
- open(FORM,">$userform");
- $loc=$dirname."?cgifunction=user";
- print FORM ("
- <script language=\"javascript\">
- location.replace(\'$loc\')\;
- </script>
- ");
- close FORM;
-
- open (ADMIN,">$admin");
- print ADMIN ("
- <HTML>
- <HEAD>
- <TITLE> Web Data Administration Password </TITLE>
- </HEAD>
-
- <BODY BGCOLOR=BEIGE onLoad=\"document.form1.password.focus()\">
- <H1 ALIGN=CENTER>
- YOU MUST HAVE A PASSWORD TO ENTER THE ADMINISTRATION SITE
- </H1>
-
- Enter password here:<BR>
- <FORM NAME=\"form1\" ACTION=\"$dirname\" METHOD=\"POST\">
- <INPUT TYPE=PASSWORD NAME=\"password\">
- <INPUT TYPE=HIDDEN NAME=\"cgifunction\" VALUE=\"admin\">
- <INPUT TYPE=SUBMIT VALUE=\"Enter\">
- </FORM>
-
- </BODY>
- </HTML>
-
- ");
- close ADMIN;
-
- open (MEMBERPAGE,">$memberentry");
- print MEMBERPAGE ("
- <HTML>
- <HEAD>
- <TITLE> Web Data Member Password </TITLE>
- </HEAD>
-
- <BODY BGCOLOR=BEIGE onLoad=\"document.form1.username.focus()\">
- <H1 ALIGN=CENTER>
- MEMBERS ENTRY PAGE.<BR>
- </H1>
-
- <TABLE BORDER=0>
- <FORM NAME=\"form1\" ACTION=\"$dirname\" METHOD=\"POST\">
- <TR><TD><B>User Name</B><TD><INPUT TYPE=TEXT NAME=\"username\" SIZE=20><BR>
- <TR><TD><B>Password</B><TD><INPUT TYPE=PASSWORD NAME=\"password\" SIZE=20><BR>
- </TABLE>
- <INPUT TYPE=SUBMIT NAME=\"cgifunction\" VALUE=\"memberpage\">
- </FORM>
- </BODY>
- </HTML>
-
- ");
- close MEMBERPAGE;
-
-
- `copy $webdata "$pathToCgiBin"`;
-
- open(BACKDOOR,">index.htm");
- print BACKDOOR ("<script>location.replace(\'$userform\')</script>");
- close BACKDOOR;
-
- print "
- Two pages have been created for your convenience in the
- current directory ($path).
-
- Guests should be linked to $userform to search your database
-
- Administrators should go to $admin to add, modify, and remove records,
- import and export, modify fields, and add members.
-
- Members with accounts can go to $memberentry to add and modify only
- their own records.
-
- If you have difficulty, please read the troubleshooting page at
- http://www.webteacher.com/perltour/testhelp.htm
-
- ";
-
-